'use strict';
module.exports = {
	/**
	 * 获取学员列表
	 * @url admin/video_course/students/sys/getList 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid, formData } = data;
		let res = { code: 0, msg: "" };
		// 业务逻辑开始-----------------------------------------------------------

		res = await vk.baseDao.getTableData({
			dbName: 'user_goods',
			data,
			sortArr: [{ "name": "_add_time", "type": "desc" }],
			whereJson: { goods_id: formData.goods_id },
			foreignDB: [{
				dbName: "uni-id-users",
				localKey: "user_id",
				foreignKey: "_id",
				as: "user",
				limit: 1
			}, {
				dbName: "uni-id-base-order",
				localKey: "oid",
				foreignKey: "_id",
				as: "order",
				limit: 1
			}]
		});

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
